<?php

class Produit {

    private $ref;
    private $nom;
    private $prix;
    private $stock;

    public function getRef() {
        return $this->ref;
    }

    public function getNom() {
        return $this->nom;
    }

    public function getPrix() {
        return $this->prix;
    }

    public function getStock() {
        return $this->stock;
    }

    function __construct($ref, $nom, $prix, $stock) {
        $this->ref = $ref;
        $this->nom = $nom;
        $this->prix = $prix;
        if ($this->prix < 0) {
            throw new Exception('Prix negatif non autorise');
        }
        $this->stock = $stock;
       
    }

}

?>
